Skip to content

feat(sdk-core): bulk TRX resource delegation SDK + Express layer#8572

Open
bhavidhingra wants to merge 1 commit intomasterfrom
chalo-287-bulk-trx-resource-delegation-sdk
Open

feat(sdk-core): bulk TRX resource delegation SDK + Express layer#8572
bhavidhingra wants to merge 1 commit intomasterfrom
chalo-287-bulk-trx-resource-delegation-sdk

Conversation

@bhavidhingra
Copy link
Copy Markdown
Contributor

@bhavidhingra bhavidhingra commented Apr 20, 2026

Summary

Resource Delegation

  • Adds buildResourceDelegations, sendResourceDelegation, sendResourceDelegations to Wallet and IWallet
  • buildResourceDelegations: POSTs to /:coin/wallet/:id/delegateResources/build, post-processes prebuilds
  • sendResourceDelegation: dispatches per wallet type — TSS → sendManyTxRequests, custodial → initiateTransaction, hot → prebuildAndSignTransaction + submitTransaction
  • sendResourceDelegations: validates passphrase, builds all, sends sequentially, collects { success, failure }
  • Adds typed Express route (PostDelegateResources) and handleV2DelegateResources handler with partial-success 202/400 response logic

Resource Undelegation

  • Adds buildResourceUndelegations, sendResourceUndelegation, sendResourceUndelegations to Wallet and IWallet — mirrors delegation API exactly
  • buildResourceUndelegations: POSTs to /:coin/wallet/:id/undelegateResources/build
  • Adds typed Express route (PostUndelegateResources) and handleV2UndelegateResources handler
  • Delegation and undelegation share private helpers (buildResourceManagements, sendResourceManagement, sendResourceManagements) to eliminate code duplication

stakingParams relay

  • Adds stakingParams?: unknown to PrebuildTransactionResult so staking metadata flows from the build response through to submitTransaction, enabling the indexer to identify resource management transfers correctly

Test plan

  • Unit test: buildResourceDelegations / buildResourceUndelegations call the right endpoints and post-process prebuilds
  • Unit test: sendResourceDelegation / sendResourceUndelegation route correctly per wallet type
  • Express: POST /api/v2/ttrx/wallet/:id/delegateResources returns 200/202/400 as appropriate
  • Express: POST /api/v2/ttrx/wallet/:id/undelegateResources returns 200/202/400 as appropriate

Linear: CHALO-287

@bhavidhingra bhavidhingra requested review from a team as code owners April 20, 2026 09:06
@linear
Copy link
Copy Markdown

linear Bot commented Apr 20, 2026

@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from 496a288 to 5bc64a4 Compare April 20, 2026 10:01
@bhavidhingra
Copy link
Copy Markdown
Contributor Author

@claude review

@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from 5bc64a4 to 42b5824 Compare April 20, 2026 10:52
@bhavidhingra bhavidhingra marked this pull request as draft April 20, 2026 10:54
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch 6 times, most recently from 15b4e19 to 5019af4 Compare April 22, 2026 15:09
@pranavjain97
Copy link
Copy Markdown
Contributor

Flush, please request re-review when ready for review.

@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch 2 times, most recently from 6a7cd84 to 982359a Compare April 23, 2026 11:32
Adds buildAccountDelegations, sendAccountDelegation, sendAccountDelegations
to the Wallet class and IWallet interface, mirroring the consolidation API.
Adds Express typed route schema and handler for
POST /api/v2/:coin/wallet/:id/delegateResources with TSS/custodial/hot wallet
branching and partial-success (202) response handling.

CHALO-287

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bhavidhingra bhavidhingra force-pushed the chalo-287-bulk-trx-resource-delegation-sdk branch from 982359a to b22a03a Compare April 23, 2026 13:28
@bhavidhingra bhavidhingra marked this pull request as ready for review April 25, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants